package com.kexio.enterprise.integration.event.result;

import com.kexio.enterprise.integration.event.enums.EventStatus;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 事件处理结果
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class EventHandleResult {
    private boolean success;
    private String eventId;
    private String handlerId;
    private EventStatus status;
    private String errorMessage;
    private LocalDateTime handleTime;
    private long processingTime;
    private Map<String, Object> resultData;

    public EventHandleResult() {
        this.handleTime = LocalDateTime.now();
    }

    public EventHandleResult(boolean success, String eventId) {
        this();
        this.success = success;
        this.eventId = eventId;
        this.status = success ? EventStatus.PROCESSED : EventStatus.FAILED;
    }

    // Getters and Setters
    public boolean isSuccess() { return success; }
    public void setSuccess(boolean success) { this.success = success; }
    
    public String getEventId() { return eventId; }
    public void setEventId(String eventId) { this.eventId = eventId; }
    
    public String getHandlerId() { return handlerId; }
    public void setHandlerId(String handlerId) { this.handlerId = handlerId; }
    
    public EventStatus getStatus() { return status; }
    public void setStatus(EventStatus status) { this.status = status; }
    
    public String getErrorMessage() { return errorMessage; }
    public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; }
    
    public LocalDateTime getHandleTime() { return handleTime; }
    public void setHandleTime(LocalDateTime handleTime) { this.handleTime = handleTime; }
    
    public long getProcessingTime() { return processingTime; }
    public void setProcessingTime(long processingTime) { this.processingTime = processingTime; }
    
    public Map<String, Object> getResultData() { return resultData; }
    public void setResultData(Map<String, Object> resultData) { this.resultData = resultData; }
}
